package li.webqq.api;

import li.http.Request;
import li.webqq.Const;
import li.webqq.util.StringUtil;

/**
 * @author 明伟
 */
public class SendQunMsg2Request extends Request implements Const {
    private String to;
    private String message;
    private String psessionid;

    public void setTo(String to) {
        this.to = to;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setPsessionid(String psessionid) {
        this.psessionid = psessionid;
    }

    public SendQunMsg2Response execute() {
        String r = StringUtil.build(R_SEND_QUN_MSG2, to, message, StringUtil.getNext(), psessionid);

        super.setUrl(URL_SEND_QUN_MSG2);
        super.setReferer(URL_PROXY);
        super.setContentType(FORM_URLENCODED);

        super.setField("r", StringUtil.encode(r));
        super.setField("clientid", CLIENT_ID);
        super.setField("psessionid", this.psessionid);

        return super.execute(new SendQunMsg2Response());
    }
}